import { createRouter, createWebHashHistory } from 'vue-router'
import Page from './../layouts/PageHome.vue' // 这是主页框架
import Layout from './../layouts/Layout.vue' // 这是内容区域

const router = createRouter({
  // 开发环境: createWebHistory(),
  // 线上：createWebHashHistory()
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'index',
      component: Page,
      children: [
        {
          name: '/',
          path: 'dashboard',
          component: Layout,
          children: [
            {
              name: 'analysis',
              path: '/dashboard/analysis',
              meta: {
                title: '分析页',
              },
              component: () => import('./../views/dashboard/analysis/index.vue')
            },
            {
              name: 'workplace',
              path: '/dashboard/workplace',
              meta: {
                title: '工作台',
              },
              component: () => import('./../views/dashboard/workplace/index.vue')
            },
          ]
        },
        {
          name: '403',
          path: '/403',
          meta: {
            title: '403',
          },
          component: () => import('./../views/error/403.vue')
        },
        {
          name: '404',
          path: '/404',
          meta: {
            title: '404',
          },
          component: () => import('./../views/error/404.vue')
        },
        {
          name: '500',
          path: '/500',
          meta: {
            title: '500',
          },
          component: () => import('./../views/error/500.vue')
        },
        {
          name: 'error',
          path: '/error',
          meta: {
            title: '错误',
          },
          component: () => import('./../views/error/error.vue')
        },
      ]
    },
  ]
})

export default router